from django.db import models
from django.contrib.auth.models import AbstractUser
from system.models import Department

#角色
class Role(models.Model):
    role_name=models.CharField(max_length=10,verbose_name='角色、职位')
    department=models.ForeignKey(to=Department,on_delete=models.CASCADE,verbose_name='部门id')
    level=models.IntegerField(verbose_name='岗位级别')
    duty = models.IntegerField(verbose_name='岗位职责',null=True,blank=True)
    class Meta:
        db_table='role'
        ordering=('-id',)
#员工模型
class AdminUser(AbstractUser):
    phone=models.CharField(max_length=11,verbose_name='手机号',unique=True)
    name = models.CharField(max_length=10)#员工的姓名
    role=models.ManyToManyField(to=Role)
    def __str__(self):
        return self.name
    class Meta:
        db_table='adminuser'
        ordering=('-id',)




